﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Schism.libs;
using Schism.Mapping;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Schism.Core
{
    public abstract class EntityBase : ISelectable
    {
        //Fields
        public CellMap ParentMap;

        protected Rectangle BoundingBox;
        
        public DungeonPos Position
        {
            get
            {
                return new DungeonPos(new Vector2(BoundingBox.X, BoundingBox.Y));
            }
            set
            {
                BoundingBox.X = (int)value.X;
                BoundingBox.Y = (int)value.Y;
            }
        }
        public Vector2 Size
        {
            get
            {
                return new Vector2(BoundingBox.Width, BoundingBox.Height);
            }
            set
            {
                BoundingBox.Width = (int)value.X;
                BoundingBox.Height = (int)value.Y;
            }
        }

        public Vector2 Center
        {
            get { return Position.MapPosition + (Size / 2); }
        }

        //ctor
        public EntityBase(CellMap parent)
        {
            this.ParentMap = parent;
        }

        //Methods
        public Rectangle HitBox
        {
            get { return BoundingBox; }
        }
    }
}
